<!-- HTML header for doxygen 1.8.3.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<title>Nordic Thingy:52 v2.2.0 : Firmware architecture</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra_stylesheet_offline.css" rel="stylesheet" type="text/css"/>
<link href="nordic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0" width="100%" class="blank">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Nordic Semiconductor" src="nordic_small.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">Nordic Thingy:52 v2.2.0
   </div>
  </td>
 </tr>
 </tbody>
</table>
<script>
var url=window.location.href.split("/").reverse()[1];
var validLinks= ["nrf5","s130","s132","s212","s332"];
var index;
for (index = 0; index < validLinks.length; ++index) {
   if ( url.indexOf(validLinks[index]) !== -1 ) {
      document.getElementById(validLinks[index]).setAttribute('class', 'doclinks docselected');
   };
};
</script>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('firmware_architecture.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Firmware architecture </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>The Thingy firmware is built on top of nRF5 Software Development Kit (SDK) v13.1.0 and utilizes many of its components, such as SDK peripheral drivers, SDK HAL, and the SoftDevice.</p>
<div class="image">
<img src="thingy_firmware_arch.png" alt="thingy_firmware_arch.png"/>
<div class="caption">
Thingy firmware architecture framework</div></div>
<p> Thingy adds the following modules on top of the nRF5 SDK:</p>
<ul>
<li>Sensor drivers - Thingy uses the SDK peripheral drivers and Hardware Access Layers (HALs) and implements its own sensor drivers on top of them. These drivers are used to perform any operations on the sensors, such as enabling or disabling them, changing their configuration, or fetching sensor data.</li>
<li>BLE handler - Handles all Bluetooth communication and dispatches events to the processes.</li>
<li>Flash storage - Flash storage of configuration parameters.</li>
<li>BLE services - Layer containing all the custom BLE services used by the Thingy modules. These services are discussed in detail in the <a class="el" href="firmware_architecture.html#fw_arch_ble_services">BLE services</a> section.</li>
<li>Thingy modules - Layer containing high level functionality and features. Controlls both the sensor drivers and the corresponding BLE services. Responsible for handling persistent storage of configuration and the default configuration.</li>
<li>Thingy application</li>
</ul>
<h1><a class="anchor" id="fw_arch_ble_services"></a>
BLE services</h1>
<p>This section focuses on the custom services used in the Thingy firmware together with their configuration parameters.</p>
<h2><a class="anchor" id="arch_config"></a>
Thingy configuration service</h2>
<p>The Thingy configuration service is responsible for handling all general configuration parameters that are not related to a particular module.</p>
<table class="doxtable">
<tr>
<th>Name </th><th>UUID </th><th>Type </th><th>Data </th><th>Description </th></tr>
<tr>
<td>Base UUID </td><td>EF68xxxx-9B35-4933-9B10-52FFA9740042 </td><td></td><td></td><td></td></tr>
<tr>
<td>Thingy configuration service </td><td>0100 </td><td></td><td></td><td></td></tr>
<tr>
<td>Device name characteristic </td><td>0101 </td><td>Write/Read </td><td>max 10 bytes </td><td>Device name as ASCII string. </td></tr>
<tr>
<td>Advertising param characteristic </td><td>0102 </td><td>Write/Read </td><td>3 bytes </td><td>Advertising parameters (in units): <ul>
<li>
uint16_t - Adv interval in ms (unit 0.625 ms). <ul>
<li>
min 32 -&gt; 20 ms </li>
<li>
max 8000 -&gt; 5 s </li>
</ul>
</li>
<li>
uint8_t - Adv timeout in s (unit 1 s). <ul>
<li>
min 0 -&gt; 0 s </li>
<li>
max 180 s -&gt; 3 min </li>
</ul>
</li>
</ul>
</td></tr>
<tr>
<td>Connection param characteristic </td><td>0104 </td><td>Write/Read </td><td>8 bytes </td><td>Connection parameters: <ul>
<li>
uint16_t - Min connection interval (unit 1.25 ms). <ul>
<li>
min 6 -&gt; 7.5 ms </li>
<li>
max 3200 -&gt; 4 s </li>
</ul>
</li>
<li>
uint16_t - Max connection interval (unit 1.25 ms). <ul>
<li>
Same as above. </li>
</ul>
</li>
<li>
uint16_t - Slave latency (number of connection events). <ul>
<li>
Range 0-499 </li>
</ul>
</li>
<li>
<p class="startli">uint16_t - Supervision timeout (unit 10 ms). </p><ul>
<li>
Min 10 -&gt; 100 ms </li>
<li>
Max 3200 -&gt; 32 s </li>
</ul>
<p>The following constraint applies: conn_sup_timeout * 4 &gt; (1 + slave_latency) * max_conn_interval that corresponds to the following Bluetooth Spec requirement: The Supervision_Timeout in milliseconds must be larger than (1 + Conn_Latency) * Conn_Interval_Max * 2, where Conn_Interval_Max is given in milliseconds.</p>
<p class="endli"></p>
</li>
</ul>
</td></tr>
<tr>
<td>Eddystone URL </td><td>0105 </td><td>Write/Read </td><td>3-17 bytes </td><td>Eddystone URL. Data format: <ul>
<li>
Byte 0: <a href="https://github.com/google/eddystone/tree/master/eddystone-url#url-scheme-prefix" target="blank">URL Scheme Prefix</a> </li>
<li>
Bytes 1+: The rest of the URL using <a href="https://github.com/google/eddystone/tree/master/eddystone-url#eddystone-url-http-url-encoding" target="blank">Eddystone URL encoding</a> <br />
 Write 0 bytes to disable Eddystone advertising. <br />
 See <a href="https://github.com/google/eddystone/tree/master/eddystone-url" target="blank">Eddystone-URL</a> for more information. </li>
</ul>
</td></tr>
<tr>
<td>Cloud token </td><td>0106 </td><td>Write/Read </td><td>max 250 bytes </td><td>Cloud token to be used for identification against cloud services. </td></tr>
<tr>
<td>FW version </td><td>0107 </td><td>Read </td><td>3 bytes </td><td><ul>
<li>
uint8_t - major </li>
<li>
uint8_t - minor </li>
<li>
uint8_t - patch </li>
</ul>
</td></tr>
<tr>
<td>MTU request </td><td>0108 </td><td>Write/Read&#160;req </td><td>3 bytes </td><td>MTU request. Not retained. <ul>
<li>
uint8_t - Peripheral exchange request <ul>
<li>
0x00 - Peripheral does not send an MTU exchange request. (Default behavior) </li>
<li>
0x01 - Peripheral sends an MTU exchange request, when written to 0x01. </li>
</ul>
</li>
<li>
uint16_t - MTU size requested (23 - 276 bytes). </li>
</ul>
</td></tr>
<tr>
<td>NFC Tag content characteristic</td><td>0109 </td><td>Write/Read </td><td>max 247 bytes </td><td>Content of NFC tag. </td></tr>
</table>
<h2><a class="anchor" id="arch_env"></a>
Environment service</h2>
<p>The environment module is responsible for reading the temperature, pressure, humidity, air quality/gas, and light intensity/color sensors, as well as for sending data and configuration. It is running on top of the environment BLE service (ble_tes), the environment sensor drivers, and the environment flash storage with base UUID EF68xxxx-9B35-4933-9B10-52FFA9740042. The configuration is stored in flash. To turn on sensor reading, enable notifications from the desired characteristic by writing 0x0001 to the Client Characteristic Configuration Descriptor (CCCD) for that characteristic.</p>
<table class="doxtable">
<tr>
<th>Name</th><th>UUID</th><th>Type</th><th>Data</th><th>Description </th></tr>
<tr>
<td>Base UUID </td><td>EF68xxxx-9B35-4933-9B10-52FFA9740042 </td><td></td><td></td><td></td></tr>
<tr>
<td>Weather station service </td><td>0200 </td><td></td><td></td><td></td></tr>
<tr>
<td>Temperature characteristic </td><td>0201 </td><td>Notify </td><td>2 bytes </td><td>Temperature in Celsius<ul>
<li>
int8_t - integer </li>
<li>
uint8_t - decimal </li>
</ul>
</td></tr>
<tr>
<td>Pressure characteristic </td><td>0202 </td><td>Notify </td><td>5 bytes </td><td>Pressure in hPa<ul>
<li>
int32_t - integer </li>
<li>
uint8_t - decimal </li>
</ul>
</td></tr>
<tr>
<td>Humidity characteristic </td><td>0203 </td><td>Notify </td><td>1 bytes </td><td>Relative humidity in %<ul>
<li>
uint8_t - RH </li>
</ul>
</td></tr>
<tr>
<td>Gas (Air quality) characteristic </td><td>0204 </td><td>Notify </td><td>4 bytes </td><td><ul>
<li>
uint16_t - eCO2 ppm </li>
<li>
uint16_t - TVOC ppb </li>
</ul>
</td></tr>
<tr>
<td>Color characteristic </td><td>0205 </td><td>Notify </td><td>8 bytes </td><td><ul>
<li>
uint16_t - Red </li>
<li>
uint16_t - Green </li>
<li>
uint16_t - Blue </li>
<li>
uint16_t - Clear </li>
</ul>
</td></tr>
<tr>
<td>Configuration characteristic </td><td>0206 </td><td>Write/Read </td><td>12 bytes </td><td><ul>
<li>
uint16_t - Temperature interval in ms (100 ms - 60 s). </li>
<li>
uint16_t - Pressure interval in ms (50 ms - 60 s). </li>
<li>
uint16_t - Humidity interval in ms (100 ms - 60 s). </li>
<li>
uint16_t - Color interval in ms (200 ms - 60 s). </li>
<li>
uint8_t - Gas mode <ul>
<li>
1 = 1 s interval </li>
<li>
2 = 10 s interval </li>
<li>
3 = 60 s interval </li>
</ul>
</li>
<li>
Color sensor LED calibration: <ul>
<li>
uint8_t - Red intensity [0 - 255] </li>
<li>
uint8_t - Green intensity [0 - 255] </li>
<li>
uint8_t - Blue intensity [0 - 255] </li>
</ul>
</li>
</ul>
</td></tr>
</table>
<h2><a class="anchor" id="arch_user_interface"></a>
User interface service</h2>
<p>The UI module handles the onboard LEDs, buttons, and other potential UI components like a quadrature decoder, touchscreen etc. The UI module runs on top of the UI BLE Service (ble_uis), the LED and button drivers, and the UI flash storage with base UUID EF68xxxx-9B35-4933-9B10-52FFA9740042. This module enables RGB LED value setting and button event notifications via BLE. Button notification is enabled by writing 0x0001 to the CCCD of the button characteristic.</p>
<table class="doxtable">
<tr>
<th>Name </th><th>UUID </th><th>Type </th><th>Data </th><th>Description  </th></tr>
<tr>
<td>Base UUID </td><td>EF68xxxx-9B35-4933-9B10-52FFA9740042 </td><td></td><td></td><td></td></tr>
<tr>
<td>UI service </td><td>0300 </td><td></td><td></td><td></td></tr>
<tr>
<td>LED characteristic </td><td>0301 </td><td>Write&#160;req/Read </td><td>Max 5 bytes </td><td>RGB Value:<ul>
<li>
uint8_t - Mode (retained for BLE connected and disconnected):<ul>
<li>
0 = Off </li>
<li>
1 = Constant </li>
<li>
2 = Breathe </li>
<li>
3 = One Shot </li>
</ul>
</li>
</ul>
Constant mode (retained for BLE connected):<ul>
<li>
uint8_t - R intensity (0 - 255)  </li>
<li>
uint8_t - G intensity (0 - 255)  </li>
<li>
uint8_t - B intensity (0 - 255)  </li>
</ul>
Breathe mode (retained for BLE connected):<ul>
<li>
uint8_t - color:<ul>
<li>
0x01 - RED </li>
<li>
0x02 - GREEN </li>
<li>
0x03 - YELLOW </li>
<li>
0x04 - BLUE </li>
<li>
0x05 - PURPLE </li>
<li>
0x06 - CYAN </li>
<li>
0x07 - WHITE </li>
</ul>
</li>
<li>
uint8_t - intensity (1-100) [%]  </li>
<li>
uint16_t - delay [ms] (50 ms - 10 s)  </li>
</ul>
One shot mode (retained for BLE connected):<ul>
<li>
uint8_t - color:<ul>
<li>
0x01 - RED </li>
<li>
0x02 - GREEN </li>
<li>
0x03 - YELLOW </li>
<li>
0x04 - BLUE </li>
<li>
0x05 - PURPLE </li>
<li>
0x06 - CYAN </li>
<li>
0x07 - WHITE </li>
</ul>
</li>
<li>
uint8_t - intensity (1-100) [%]  </li>
</ul>
Default connected behavior:<ul>
<li>
Mode: Breathe </li>
<li>
Color: CYAN </li>
<li>
Intensity: 20% </li>
<li>
Delay: 3500 ms </li>
</ul>
</td></tr>
<tr>
<td>Button characteristic </td><td>0302 </td><td>Notify </td><td>1 byte </td><td>Boolean button state:<ul>
<li>
0: Button released </li>
<li>
1: Button pressed </li>
</ul>
</td></tr>
<tr>
<td>EXT pin characteristic </td><td>0303 </td><td>Write&#160;req/Read </td><td>4 bytes </td><td><p class="starttd"></p>
<p>External pin control. Range 0 - 255. 0 is off, 255 is on.</p>
<p></p>
<p>PWM is not implemented. So either 0 or 255.</p>
<ul>
<li>
uint8_t - MOS_1 </li>
<li>
uint8_t - MOS_2 </li>
<li>
uint8_t - MOS_3 </li>
<li>
uint8_t - MOS_4 </li>
</ul>
</td></tr>
</table>
<h2><a class="anchor" id="arch_motion"></a>
Motion service</h2>
<p>The motion module is responsible for reading the 9-axis motion sensor and the low power accelerometer, as well as for sending the data and flash storage of the configuration parameters for this module. It is running on top of the motion BLE service (ble_tms) with base UUID EF68xxxx-9B35-4933-9B10-52FFA9740042. The configuration is stored in flash memory. To turn on sensor reading, enable notifications from the desired characteristic by writing 0x0001 to the Client Characteristic Configuration Descriptor (CCCD) for that characteristic.</p>
<table class="doxtable">
<tr>
<th>Name </th><th>UUID </th><th>Type </th><th>Data </th><th>Description  </th></tr>
<tr>
<td>Base UUID </td><td>EF68xxxx-9B35-4933-9B10-52FFA9740042 </td><td></td><td></td><td></td></tr>
<tr>
<td>Thingy motion service </td><td>0400 </td><td></td><td></td><td></td></tr>
<tr>
<td>Config characteristic </td><td>0401 </td><td>Write/Read </td><td>9 bytes </td><td>Motion configuration:<ul>
<li>
uint16_t - Step counter interval in ms (100 ms - 5 s). </li>
<li>
uint16_t - Temperature compensation interval in ms (100 ms - 5 s). </li>
<li>
uint16_t - Magnetometer compensation interval in ms (100 ms - 1 s). </li>
<li>
uint16_t - Motion processing unit frequency in Hz (5 - 200 Hz). </li>
<li>
uint8_t - Wake-on-motion <ul>
<li>
0x00 = Off  </li>
<li>
0x01 = On  </li>
</ul>
</li>
</ul>
</td></tr>
<tr>
<td>Tap characteristic </td><td>0402 </td><td>Notify </td><td>2 bytes </td><td>Direction and count of taps:<ul>
<li>
uint8_t - Direction:<ul>
<li>
0x01 = TAP_X_UP </li>
<li>
0x02 = TAP_X_DOWN </li>
<li>
0x03 = TAP_Y_UP </li>
<li>
0x04 = TAP_Y_DOWN </li>
<li>
0x05 = TAP_Z_UP </li>
<li>
0x06 = TAP_Z_DOWN </li>
</ul>
</li>
<li>
uint8_t - Count <ul>
<li>
Number of taps in the given direction </li>
</ul>
</li>
</ul>
</td></tr>
<tr>
<td>Orientation characteristic </td><td>0403 </td><td>Notify </td><td>1 byte </td><td><ul>
<li>
uint8_t - Orientation <ul>
<li>
0x00 = Portrait </li>
<li>
0x01 = Landscape </li>
<li>
0x02 = Reverse portrait </li>
<li>
0x03 = Reverse landscape </li>
</ul>
</li>
</ul>
</td></tr>
<tr>
<td>Quaternion characteristic </td><td>0404 </td><td>Notify </td><td>16 bytes </td><td>Attitude represented with quaternions (2Q30 fixed point):<ul>
<li>
int32_t - w </li>
<li>
int32_t - x </li>
<li>
int32_t - y </li>
<li>
int32_t - z </li>
</ul>
</td></tr>
<tr>
<td>Step counter characteristic  </td><td>0405 </td><td>Notify </td><td>8 bytes </td><td>Step counter:<ul>
<li>
uint32_t - Steps  </li>
<li>
uint32_t - Time [ms] </li>
</ul>
</td></tr>
<tr>
<td>Raw data characteristic </td><td>0406 </td><td>Notify </td><td>18 bytes </td><td>Motion sensor raw data:<ul>
<li>
Accelerometer<ul>
<li>
int16_t - x [G] (6Q10 fixed point) </li>
<li>
int16_t - y [G] (6Q10 fixed point) </li>
<li>
int16_t - z [G] (6Q10 fixed point) </li>
</ul>
</li>
<li>
Gyroscope<ul>
<li>
int16_t - x [deg/s] (11Q5 fixed point) </li>
<li>
int16_t - y [deg/s] (11Q5 fixed point) </li>
<li>
int16_t - z [deg/s] (11Q5 fixed point)  </li>
</ul>
</li>
<li>
Compass<ul>
<li>
int16_t - x [µT] (12Q4 fixed point) </li>
<li>
int16_t - y [µT] (12Q4 fixed point) </li>
<li>
int16_t - z [µT] (12Q4 fixed point) </li>
</ul>
</li>
</ul>
</td></tr>
<tr>
<td>Euler characteristic </td><td>0407 </td><td>Notify </td><td>12 bytes </td><td>Attitude represented in Euler angles (16Q16 fixed point)<ul>
<li>
int32_t - roll [degrees] </li>
<li>
int32_t - pitch [degrees] </li>
<li>
int32_t - yaw [degrees] </li>
</ul>
</td></tr>
<tr>
<td>Rotation matrix char </td><td>0408 </td><td>Notify </td><td>18 bytes </td><td>Attitude in rotation matrix (2Q14 fixed point)<ul>
<li>
int16_t [9] - 3 x 3 matrix </li>
</ul>
</td></tr>
<tr>
<td>Heading characteristic </td><td>0409 </td><td>Notify </td><td>4 bytes </td><td>Heading (16Q16 fixed point)<ul>
<li>
int32_t - Heading [degrees] </li>
</ul>
</td></tr>
<tr>
<td>Gravity vector </td><td>040A </td><td>Notify </td><td>12 bytes </td><td>Attitude represented by a gravity vector:<ul>
<li>
float - x </li>
<li>
float - y </li>
<li>
float - z </li>
</ul>
</td></tr>
</table>
<h2><a class="anchor" id="arch_sound"></a>
Sound service</h2>
<p>The sound module is responsible for handling both the speaker and the microphone. The sound module is built on top of the sound BLE service (ble_tss) with base UUID EF68xxxx-9B35-4933-9B10-52FFA9740042. The configuration is stored in flash.</p>
<table class="doxtable">
<tr>
<th>Name </th><th>UUID </th><th>Type </th><th>Data </th><th>Description  </th></tr>
<tr>
<td>Base UUID </td><td>EF68xxxx-9B35-4933-9B10-52FFA9740042 </td><td></td><td></td><td></td></tr>
<tr>
<td>Thingy sound service </td><td>0500 </td><td></td><td></td><td></td></tr>
<tr>
<td>Config characteristic </td><td>0501 </td><td>Write/Read </td><td>2 bytes </td><td>Sound configuration<ul>
<li>
uint8_t - Speaker mode:<ul>
<li>
0x01 - Frequency and duration. </li>
<li>
0x02 - 8-bit PCM </li>
<li>
0x03 - Sample </li>
</ul>
</li>
<li>
uint8_t - Microphone mode<ul>
<li>
0x01 - ADPCM </li>
<li>
0x02 - SPL </li>
</ul>
</li>
</ul>
</td></tr>
<tr>
<td>Speaker data characteristic </td><td>0502 </td><td>Write without resp </td><td>Max 273 bytes </td><td>In frequency mode:<ul>
<li>
uint16_t - Frequency in Hz (0 - stop forever). </li>
<li>
uint16_t - Duration in ms (0 = forever). </li>
<li>
uint8_t - Volume in % (0-100). </li>
</ul>
In PCM mode:<ul>
<li>
uint8_t [20 - 273] 8-bit PCM samples </li>
</ul>
In sample mode:<ul>
<li>
uint8_t - sample ID (0x00 - 0x08)<ul>
<li>
0 Collect_Point_00.wav </li>
<li>
1 Collect_Point_01.wav </li>
<li>
2 Explosion_02.wav </li>
<li>
3 Explosion_04.wav </li>
<li>
4 Hit_00.wav </li>
<li>
5 Pickup_01.wav </li>
<li>
6 Pickup_03.wav </li>
<li>
7 Shoot_00.wav </li>
<li>
8 Shoot_01.wav </li>
</ul>
</li>
</ul>
</td></tr>
<tr>
<td>Speaker status characteristic </td><td>0503 </td><td>Notify </td><td>1 byte </td><td>Speaker status<ul>
<li>
uint8_t - 0x00 - Finished </li>
<li>
uint8_t - 0x01 - Buffer warning </li>
<li>
uint8_t - 0x02 - Buffer ready </li>
<li>
uint8_t - 0x10 - Packet disregarded </li>
<li>
uint8_t - 0x11 - Invalid command </li>
</ul>
</td></tr>
<tr>
<td>Microphone characteristic </td><td>0504 </td><td>Notify </td><td>Max 273 bytes </td><td>ADCPM mode<ul>
<li>
ADPCM frame </li>
</ul>
</td></tr>
</table>
<h2><a class="anchor" id="arch_battery"></a>
Battery service</h2>
<p>This module is responsible for handling battery level information.</p>
<table class="doxtable">
<tr>
<th>Name </th><th>UUID </th><th>Type </th><th>Data </th><th>Description  </th></tr>
<tr>
<td>UUID </td><td>180F </td><td>Notify/Read </td><td>1 byte </td><td><ul>
<li>
uint8_t State of charge [%] (0-100) </li>
</ul>
Uses a lookup table to convert from battery voltage to state of charge (SoC). Due to the ADC configuration and battery model, certain percentage values are skipped. Will only update/notify if there is a change in remaining battery level.   </td></tr>
</table>
<h2><a class="anchor" id="arch_dfu"></a>
DFU service</h2>
<p>This module is responsible for running Device Firmware Updates on Thingy.</p>
<table class="doxtable">
<tr>
<th>Name </th><th>UUID </th><th>Type </th><th>Data </th><th>Description  </th></tr>
<tr>
<td>Secure DFU Service </td><td>FE59 </td><td></td><td></td><td></td></tr>
<tr>
<td>Base UUID </td><td>0000xxxx-0000-1000-8000-00805f9b34fb </td><td></td><td></td><td></td></tr>
<tr>
<td>DFU Control Point characteristic </td><td>8EC90001-F315-4F60-9FB8-838830DAEA50 </td><td>Notify/Write </td><td>1 byte </td><td><p class="starttd">Steps to put Thingy into Buttonless DFU mode:</p><ul>
<li>
Enable notifications for the DFU Control point characteristic </li>
<li>
Write 0x01 to the characteristic </li>
</ul>
<p class="endtd"></p>
</td></tr>
</table>
<h1><a class="anchor" id="firmware_components"></a>
Firmware components</h1>
<p>This firmware consists of the following components. Follow the links for their API documentation.</p>
<h2><a class="anchor" id="comp_ble_services"></a>
BLE services</h2>
<ul>
<li><a class="el" href="group__ble__sdk__srv__tcs.html">Thingy Configuration Service</a> Service that handles various configuration characteristics.</li>
<li><a class="el" href="group__ble__sdk__srv__tes.html">Thingy Environment Service</a> GATT-based service with multiple characteristics for reading environment sensor data and configuring the sensors.</li>
<li><a class="el" href="group__ble__sdk__srv__wss.html">Thingy Motion Service</a> GATT-based service with multiple characteristics for reading motion sensor data and configuring the sensors.</li>
<li><a class="el" href="group__ble__srv__tss.html">Thingy Sound service</a> GATT-based service that handles the Thingy microphone and speaker.</li>
<li><a class="el" href="group__ble__sdk__srv__uis.html">Thingy User interface service</a> Service that handles the Thingy RGB LED and button.</li>
</ul>
<h2><a class="anchor" id="comp_drivers"></a>
Drivers</h2>
<ul>
<li><a class="el" href="group__driver__acc.html">Accelerometer driver</a> Accelerometer driver API, including the LIS3DH accelerometer.</li>
<li><a class="el" href="group__color__driver.html">Color sensor</a> Digital color sensor API, including the BH1745 color sensor.</li>
<li><a class="el" href="group__gpio__ext__driver.html">GPIO extender</a> GPIO extender API.</li>
<li><a class="el" href="group__gas__sensor.html">Gas sensor</a> Digital gas sensor API, including the CCS811 gas sensor.</li>
<li><a class="el" href="group__humidity__driver.html">Humidity sensor</a> Humidity sensor API, including the HTS221 sensor.</li>
<li><a class="el" href="group__mic__driver.html">Microphone</a> Microphone driver API.</li>
<li><a class="el" href="group__motion__driver.html">Motion sensor</a> Motion sensor API.</li>
<li><a class="el" href="group___n_f_c__driver.html">NFC driver</a> Near Field Communnication (NFC) driver API.</li>
<li><a class="el" href="group__press__driver.html">Pressure sensor</a> Pressure sensor API, including the LPS22HB sensor.</li>
<li><a class="el" href="group__speaker__driver.html">Speaker</a> Speaker driver API.</li>
</ul>
<h2><a class="anchor" id="comp_modules"></a>
Thingy modules</h2>
<ul>
<li><a class="el" href="group__m__ble.html">BLE handling</a> BLE handling module API, including its flash configuration.</li>
<li><a class="el" href="group__m__batt__meas.html">Battery measurement</a> Battery measurement module API, including its flash configuration.</li>
<li><a class="el" href="group__m__environment.html">Environment</a> Environment module API, including its flash configuration.</li>
<li><a class="el" href="group__m__motion.html">Motion</a> Motion module API, including its flash configuration.</li>
<li><a class="el" href="group__m__sound.html">Sound</a> Sound module API.</li>
<li><a class="el" href="group__m__ui.html">User interface</a> User interface module API, including its flash configuration.</li>
</ul>
<h2><a class="anchor" id="comp_utils"></a>
Utilities</h2>
<ul>
<li><a class="el" href="group__macros__common.html">Common macros</a> A set of useful macros.</li>
<li><a class="el" href="group__ble__sdk__adv__beacon.html">Eddystone beacon</a> A set of APIs related to Eddystone beacon advertising.</li>
<li><a class="el" href="group__sx150x__led__drv__regs.html">Sx150x LED driver registers</a> Settings for all LED driver registers on the Sx150x.</li>
<li><a class="el" href="group__sx150x__led__drv__calc.html">Sx150x LED driver register calculation</a> Sx150x LED driver register calculation API.</li>
<li><a class="el" href="group__support__func.html">Support functions</a> Support functions. </li>
</ul>
</div></div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="topicfooter">
<a href="mailto:docfeedback@nordicsemi.no?subject=Documentation%20feedback" id="maillink">Documentation feedback</a> | <a href="https://devzone.nordicsemi.com/questions/" target="_blank">Developer Zone</a> | <a href="http://response.nordicsemi.com/subscribe-to-our-newsletters" target="_blank">Subscribe</a> | Updated <span id="date"/>
<script>
var date = new Date("Thu Feb 7 2019" + " UTC");
document.getElementById("date").innerHTML = date.toJSON().slice(0, 10);
var url=window.location.href.split("?")[0];
var filename=url.substring(url.lastIndexOf('/')+1);
document.getElementById("maillink").href = "mailto:docfeedback@nordicsemi.no?subject=Documentation%20feedback"+decodeURIComponent("%26")+"body=File%20name%3A%20"+encodeURIComponent(filename);
</script>
</div>
</body>
</html>
